<script setup>
	import {
		onLaunch,
		onShow,
		onHide
	} from "@dcloudio/uni-app";

	onLaunch(() => {
		console.log("App Launch");
		// 检查版本更新
		// checkNewVersion();
	});

	onShow(() => {
		console.log("App Show");
	});

	onHide(() => {
		console.log("App Hide");
	});

	// 检查版本更新
	function checkNewVersion() {
		const updateManager = uni.getUpdateManager();
		updateManager.onCheckForUpdate(function(res) {
			console.log(res.hasUpdate, "请求完新版本信息的回调");
		});
		updateManager.onUpdateReady(function() {
			uni.showModal({
				title: "小程序更新",
				content: "为保证功能正常, 请更新后使用",
				showCancel: false,
				success(res) {
					if (res.confirm) {
						updateManager.applyUpdate();
					}
				},
			});
		});
		updateManager.onUpdateFailed(function() {
			uni.showModal({
				title: "更新失败",
				content: "请删除小程序后, 重新添加!",
				showCancel: false,
			});
		});
	}
</script>

<style lang="scss">
	page {
		width: 100%;
		height: 100%;
		font-family: 'PingFang SC';
		background: #f2f2f2;

	}
</style>